<?php 
    $this->headMeta()->appendHttpEquiv('Content-Type','text/html;charset=utf-8'); 
    $this->headTitle()->setSeparator(' - '); 
    $this->headTitle('3S'); 
    $auth = Zend_Auth::getInstance()->getIdentity(); 
    
    $params = Zend_Controller_Front::getInstance()->getRequest();
    $dashId = ($params->getParam('dashId')) ? $params->getParam('dashId') : 0;
    $acl = new My_Acl();
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<?php echo BASE_URL;?>" />
		<meta charset="utf-8"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
		<meta name="viewport" content="width=device-width, initial-scale=1"/>
		<meta name="description" content=""/>
		<meta name="author" content=""/>
		<link rel="icon" href="/static/images/favicon.png"/>
		<?php echo $this->headMeta(); ?>
		<?php echo $this->headTitle(); ?>
        <!-- Jquery ui 1.11 -->
        <link href="/static/css/jquery-ui.min.css" rel="stylesheet"/>
        
        <link href="/static/css/jquery-ui.theme.min.css" rel="stylesheet"/>
        <link href="/static/css/jquery-ui-timepicker-addon.css" rel="stylesheet"/>
		<!-- Bootstrap core CSS -->
		<link href="/static/css/bootstrap.min.css" rel="stylesheet"/>
        <!-- Simple sidebar -->
        <link href="/static/css/simple-sidebar.css" rel="stylesheet"/>
		<!-- Custom styles for this template -->
		<link href="/static/css/dashboard.css" rel="stylesheet"/>
		<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
		<!--[if lt IE 9]>
			<script src="/static/js/ie8-responsive-file-warning.js">
			</script>
		<![endif]-->
		<link href="/static/css/style.css" rel="stylesheet"/>
		<link href="/static/css/style-responsive.css" rel="stylesheet"/>
        <script src="/static/includes/ckeditor/ckeditor.js"></script>
		<script src="/static/js/ie-emulation-modes-warning.js">
		</script>
		<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
		<script src="/static/js/ie10-viewport-bug-workaround.js"></script>
        <script src="/static/js/nicEdit.js"></script>
       
		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
			</script>
			<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js">
			</script>
		<![endif]-->
        
        <script src="/static/js/jquery-1.11.1.min.js" type="text/javascript"></script>
		<script src="/static/js/jquery.cookie-1.4.1.js" type="text/javascript"></script>
		<script src="/static/js/jquery-ui.min.js" type="text/javascript"></script>
		<script src="/static/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
		<!-- Jquery - end================================================-->
        
		<!-- Bootstrap core JavaScript - start================================================-->
		<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
		<!-- <script src="/static/js/docs.min.js" type="text/javascript"></script>-->
		<!-- Bootstrap core JavaScript - end==================================================-->
        
        <script src="/static/js/jquery.touchwipe.min.js" type="text/javascript"></script>
        
        <!-- Fancybox -->
        <script src="/static/addon/fancybox-2.1.5/jquery.mousewheel.pack.js" type="text/javascript"></script>
        <link href="/static/addon/fancybox-2.1.5/jquery.fancybox.css" rel="stylesheet" type="text/css" media="screen" />
        <script src="/static/addon/fancybox-2.1.5/jquery.fancybox.pack.js" type="text/javascript"></script>

        <script src="/static/js/jquery.touchwipe.min.js" type="text/javascript"></script>
		<script src="/static/js/script.js" type="text/javascript"></script>
	</head>
	<body>
		<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
			<div class="container-fluid">
                <div class="logo col-sm-3 col-md-2">
                    <a href="admin/index/index"><img class="img-responsive" src="/static/images/anhbia.jpg" title="KPI Report" alt="KPI Report"/></a>
                    <span id="menu-toggle" href="#" class="btn btn-default glyphicon glyphicon-list hidden"><i class="icon-reorder"></i></span>
                    </div>
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
						<span class="sr-only">
							Toggle navigation
						</span>
						<span class="icon-bar">
						</span>
						<span class="icon-bar">
						</span>
						<span class="icon-bar">
						</span>
					</button>
				</div>
                <div class="navbar-menu">
                    <ul>
                        <li><a href="#"><span class="glyphicon glyphicon-home"></span><span class="background background-green-1 glyphicon glyphicon-home"></span></a></li>
                        <li><a href="#"><span class="glyphicon glyphicon-headphones"></span><span class="background background-green-2 glyphicon glyphicon-headphones"></span></a></li>
                        <li><a href="#"><span class="glyphicon glyphicon-list-alt"></span><span class="background background-orange-1 text">5</span></a></li>
                        <li><a href="#"><span class="glyphicon glyphicon-envelope"></span><span class="background background-red-1 text">7</span></a></li>
                    </ul>
                </div>
				<div class="navbar-collapse collapse">
					<ul class="nav navbar-nav navbar-right">
						<li>
							<a href="#">Profile</a>
						</li>
						<li>
							<a href="admin/auth/logout">Logout</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
        <div class="clear"></div>
		<div class="container-fluid" id="wrapper">
			<div class="row">
				<div class="col-sm-3 col-md-2 sidebar">
                    <div class="avatar">
                        <img src="/static/images/loc.jpg" class="img-circle"/>
                        <span><?php echo $auth['username'];?></span>
                        <a href="/default/profile/index">Thông tin</a>
                    </div>
                    <ul class="sidebar-nav">
                        <?php 
                        if(!isset($_COOKIE['checkMenu'])){
                            setcookie("checkMenu", 0, time()+20000000);
                        }
                        
                        $acl                = new My_Acl();
                        $listAllow          = $acl->listResourceAllowed();
                        $listMenu           = array();
                        foreach($listAllow as $row){
                            if($row['moduleName'] == 'admin' && $row['actionName'] == 'index' && !in_array($row['controllerName'], $listMenu)){
                                $listMenu[]     = $row['controllerName'];
                            }
                        }
                        $menuModule         = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
                        $menuController     = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
                        $menuAction         = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
                        
                        if($listMenu)?>
                            <li <?php if($_COOKIE['checkMenu']==0)echo 'class="active"';?>>
                                 <span>
                                    <span class='glyphicon glyphicon-cog'></span>
                                    <span class='background background-red-1'></span>
                                    <span class='text'>Admin</span>
                                 </span>
                                 <ul <?php if($_COOKIE['checkMenu']==0)echo 'class="hidden"';?>>                       
                        <?php foreach($listMenu as $menu){
    
                            if($menu == "role"){
                                echo '<li><a href="/admin/role">
                                    <span class="glyphicon glyphicon-lock"></span>
                                    <span class="background" style="left: -40px; background: yellow;">
                                    </span>
                                    <span class="text">Phân quyền</span></a></li>';
                            }
                            elseif($menu == "user"){
                                echo '<li><a href="/admin/user">
                                    <span class="glyphicon glyphicon-user"></span>
                                    <span class="background" style="left: -40px; background: #A2D200;">
                                    </span>
                                    <span class="text">Thành viên</span></a></li>';
                            }
                            elseif($menu == "adsfor"){
                                echo '<li><a href="/admin/adsfor">
                                    <span class="glyphicon glyphicon-home"></span>
                                    <span class="background" style="left: -40px; background: #00FF33;">
                                    </span>
                                    <span class="text">Tin Rao Bán - Cho Thuê</span></a></li>';
                            }
                            elseif($menu == "admin"){
                                echo '<li><a href="/admin/admin">
                                    <span class="glyphicon glyphicon-user"></span>
                                    <span class="background" style="left: -40px; background: #A2D200;">
                                    </span>
                                    <span class="text">Tài khoản Quản trị</span></a></li>';
                            }
                            elseif($menu == "user"){
                                echo '<li><a href="/admin/user">
                                    <span class="glyphicon glyphicon-user"></span>
                                    <span class="background" style="left: -40px; background: #FF635C;">
                                    </span>
                                    <span class="text">Tài khoản người dùng</span></a></li>';
                            }
                            elseif($menu == "newscat"){
                                echo '<li><a href="/admin/newscat">
                                    <span class="glyphicon glyphicon-th-list"></span>
                                    <span class="background" style="left: -40px; background: #FF635C;">
                                    </span>
                                    <span class="text">Danh mục tin tức</span></a></li>';
                            }
                            elseif($menu == "resource"){
                                echo '<li><a href="/admin/resource">
                                    <span class="glyphicon glyphicon-list-alt"></span>
                                    <span class="background" style="left: -40px; background: #FF635C;">
                                    </span>
                                    <span class="text">Resource</span></a></li>';
                            }
                            elseif($menu == "company"){
                                echo '<li><a href="/admin/company">
                                    <span class="glyphicon glyphicon-stats"></span>
                                    <span class="background" style="left: -40px; background: #FF635C;">
                                    </span>
                                    <span class="text">Doanh nghiệp</span></a></li>';
                            }
                            elseif($menu == "project"){
                                echo '<li><a href="/admin/project">
                                    <span class="glyphicon glyphicon-briefcase"></span>
                                    <span class="background" style="left: -40px; background: #FF635C;">
                                    </span>
                                    <span class="text">Dự án</span></a></li>';
                            }
                            elseif($menu == "estate"){
                                echo '<li><a href="/admin/estate">
                                    <span class="glyphicon glyphicon-home"></span>
                                    <span class="background" style="left: -40px; background: #00FF33;">
                                    </span>
                                    <span class="text">Danh mục bất động sản</span></a></li>';
                            }
                        }
                      ?>
                    </ul>
                    </li>
                </div>
				<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main main-content">
                    <?php echo $this->layout()->content; ?>
				</div>
			</div>
		</div>
		<!-- Jquery - start================================================-->

	</body>

</html>